package com.hawthorn.admin.repository.provider;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.builder.annotation.ProviderMethodResolver;

import java.util.Map;

/**
 * <p>todo 渠道商档案表 Provider sql</p>
 * @author: zhouxin@expservice.com.cn
 * @created: 2022-07-08 3:38 PM
 * @lasted: 2022-07-21 9:40 AM
 * @version v1.0.2
 */
public class SysDealerSqlProvider implements ProviderMethodResolver {

  public static String find(Page<Map<String, Object>> page, String qc)
  {
    StringBuffer sql = new StringBuffer();
    sql.append("select \n");
    sql.append("  a.id as id, \n");
    sql.append("  a.dealer_code as dealerCode, \n");
    sql.append("  a.dealer_name as dealerName, \n");
    sql.append("  a.dealer_sname as dealerSname, \n");
    sql.append("  a.dealer_kind as dealerKind, \n");
    sql.append("  a.dealer_status as dealerStatus, \n");
    sql.append("  a.claim_rate as claimRate, \n");
    sql.append("  a.province as province, \n");
    sql.append("  a.city as city, \n");
    sql.append("  a.town as town, \n");
    sql.append("  a.store_address as storeAddress, \n");
    sql.append("  a.finace_num as finaceNum, \n");
    sql.append("  a.finace_name as finaceName, \n");
    sql.append("  a.legal_person as legalPerson, \n");
    sql.append("  a.legal_persontel as legalPersontel, \n");
    sql.append("  a.legal_email as legalEmail, \n");
    sql.append("  a.organizing_code as organizingCode, \n");
    sql.append("  a.website as website, \n");
    sql.append("  a.taxpayer_number as taxpayerNumber, \n");
    sql.append("  a.openning_bank as openningBank, \n");
    sql.append("  a.bank_account as bankAccount, \n");
    sql.append("  a.openning_bankname as openningBankname, \n");
    sql.append("  a.enterprise_property as enterpriseProperty, \n");
    sql.append("  a.dealer_star as dealerStar, \n");
    sql.append("  a.start_date as startDate, \n");
    sql.append("  a.logout_date as logoutDate, \n");
    sql.append("  a.parent_org as parentOrg, \n");
    sql.append("  a.taxpayer_scacle as taxpayerScacle, \n");
    sql.append("  a.telexrelease as telexrelease, \n");
    sql.append("  a.remark as remark, \n");
    sql.append("  a.org_type as orgType, \n");
    sql.append("  a.create_by as createBy, \n");
    sql.append("  a.create_time as createTime, \n");
    sql.append("  a.last_update_by as lastUpdateBy, \n");
    sql.append("  a.last_update_time as lastUpdateTime, \n");
    sql.append("  a.status as status, \n");
    sql.append("  b.cname as cname \n");
    sql.append(" from \n");
    sql.append("  sys_dealer a left join sys_company b on a.d_company_id = b.id \n");
    sql.append(" where\n ");
    sql.append(qc);
    return sql.toString();
  }

  public static String export(String fields, String qc)
  {
    StringBuffer sql = new StringBuffer();
    sql.append("select ");
    sql.append(fields);
    sql.append(" from sys_dealer \n");
    sql.append("where ");
    sql.append(qc);
    return sql.toString();
  }
}
